package com.xuhuan.example.example063;

/**
 * @author: huan.xu
 * @create: 2023/11/14 10:44
 * @description:
 **/
public class Employee implements Comparable<Employee> {

    private int id;
    private String name;
    private int age;

    public Employee(int id, String name, int age) {
        this.id = id;
        this.name = name;
        this.age = age;
    }

    @Override
    public int compareTo(Employee employee) {
        if (id > employee.id) {
            return 1;
        } else if (id < employee.id) {
            return -1;
        }
        return 0;
    }

    @Override
    public String toString() {
        StringBuilder builder = new StringBuilder("");
        builder.append("员工的编号：" + id + ",");
        builder.append("员工的姓名：" + name + ",");
        builder.append("员工的年龄：" + age);
        return builder.toString();
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }
}
